package com.atguigu.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * <P> @Author: ideaAdmin
 * <P> TODO: Class
 * <P> TODO:
 * <P> Date: 2022/2/27:10:35
 * <P> Description:
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
    private Long id;

    public User(String name, Integer age, String email) {
        this.name = name;
        this.age = age;
        this.email = email;
    }

    private String name;
    private Integer age;
    private String email;
    //添加时候添加值 自动填充
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;  //create_time
    //添加或者更新的时候更新值
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime; //update_time

    //表示需要比较版本更新
    @Version
    @TableField(fill = FieldFill.INSERT)
    private Integer version;

    //逻辑删除
    //0表示有效 1表示删除
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    Integer deleted;

}
